<template>
  <div class="school">
    <span>{{name}}</span><br/>
    <span>{{address}}</span><br/>
    <button @click="schoolShowName(name)">点击获取学校</button>
  </div>
</template>

<script>
export default {
  name: "SchoolComponent",
  data() {
    return {
      name: "尚硅谷",
      address: "北京"
    }
  },
  props: ['showName'],
  methods: {
    schoolShowName(name) {
      this.showName(name);
    }
  }
}
</script>

<style>
  .school {
    margin: 20px;
    padding: 10px;
    background-color: #42b983;
  }
</style>